#include <stdio.h>

int sum(const int *const arr, const int n) {
    int i, s = 0;
    for (i = 0; i < n; i++)
        s = s + arr[i];   /*用指针/下标法引用数组元素*/
    return (s);
}


int main() {

    int i, n, a[100];

    printf("Enter the number of elements: ");
    scanf("%d", &n);

    printf("Enter %d numbers: ", n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);

    printf("Sum is %d\n", sum(a, n));

    return 0;

}